
//
//  UIBarButtonItem+Extension.swift
//  微博01
//
//  Created by 牛威 on 15/12/7.
//  Copyright © 2015年 牛威. All rights reserved.
//

import UIKit

extension UIBarButtonItem {

  
     //MARK: - 便利构造函数
 
    convenience init(imageName : String?,target:AnyObject?,action : Selector) {
        
        self.init()
        
        let button = UIButton()
        
        button.setImage(UIImage(named: imageName!), forState:.Normal)
        button.setImage(UIImage(named: "\(imageName!)_highlighted"), forState:.Highlighted)
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        
        //设置大小
        
        button.sizeToFit()

        customView = button
    }
    



}
